package com.ecoolex.cms.system.core.manager;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ecoolex.cms.system.core.dao.SunrisedutyfreeApplicationDAO;
import com.ecoolex.cms.system.entity.SunrisedutyfreeApplication;
import com.ecoolex.cms.system.entity.SunrisedutyfreeApplicationExample;


@Service
public class SunrisedutyfreeApplicationManager {

	@Autowired
	private SunrisedutyfreeApplicationDAO dao;

	public SunrisedutyfreeApplication getByAppidAndSecret(String appId, String secret) {
		SunrisedutyfreeApplicationExample example = new SunrisedutyfreeApplicationExample();
		example.createCriteria().andAppIdEqualTo(appId).andAccessSecretEqualTo(secret).andDeletedEqualTo(
			SunrisedutyfreeApplication.NOT_DELETED);
		return dao.selectOneByExample(example);
	}
	
	public SunrisedutyfreeApplication getByAppid(String appId) {
		SunrisedutyfreeApplicationExample example = new SunrisedutyfreeApplicationExample();
		example.createCriteria().andAppIdEqualTo(appId).andDeletedEqualTo(
			SunrisedutyfreeApplication.NOT_DELETED);
		return dao.selectOneByExample(example);
	}
}